home *** CD-ROM | disk | FTP | other *** search
- global gWorld, gStates, gOBJECTS, gHotRects, gScreenState, gCursorList, gTimerList, gHitMaps, gCursorPresent, gKeyRef, cNullCast, cNullQTmovie, NULLRECT, gSpritePropTypes, gQTproplist, cNUllCharmovie, sPICTSPRITE, sQTSPRITE, sCURSORSPRITE, sCPSprite, sQTCharSprite, gUnvObjects, gAngles, gLastCursor, gPlayingQT, gScreenWidth, gScreenHeight, gCurKeyList, gTransMovieName, gAnimationObjects, gDeathRow, gLastKeyList, gKeyFrameSound, gEnvironmentSound, gGlobal, gKeyFrameSoundMode, gHaveNavs, gNextEnvLetter, gNextDIRFile, gMIDIPlayTRUE, gInitalized, xNAVXOBJ, xCURXOBJ, gCPU, gfileSep, gRootPath, gHDpath, gXobjs, gXOBJPath, gCDpath, gCDName, gQTmovPath, gSoundPath
-
- on MainLoop
- SetCursor(the mouseH, the mouseV)
- CallAnimEngine()
- CallTheTimer()
- serviceSound()
- CheckMIDI()
- go(the frame)
- end
-
- on CheckMIDI
- if gMIDIPlayTRUE = #false then
- exit
- end if
- midiInterrupt()
- end
-
- on SetCursor H, v
- set aPoint to point(H, v)
- set ObjRef to inHotSpot(aPoint)
- if ObjRef <> #empty then
- set thisCursor to getaProp(getaProp(gOBJECTS, ObjRef), #cursor)
- else
- if gHaveNavs <> #false then
- set navRefNum to inNavSpot(H, v)
- if navRefNum <> #empty then
- set thisCursor to getAt(getaProp(gCursorList, #NAV), navRefNum)
- else
- set thisCursor to getaProp(gCursorList, #NullCursor)
- end if
- else
- if gHaveNavs = #false then
- set thisCursor to getaProp(gCursorList, #NullCursor)
- end if
- end if
- end if
- set GraphicCursor to CallCursorPresent(H, v)
- if (thisCursor <> gLastCursor) and (GraphicCursor = #false) then
- set gLastCursor to thisCursor
- cursor(thisCursor)
- end if
- end
-
- on CallCursorPresent H, v
- if gCursorPresent = #false then
- return #false
- end if
- repeat with MAPlist in gHitMaps
- set map to getaProp(MAPlist, #hitxobj)
- set index to getaProp(getaProp(MAPlist, #INDEXLIST), map(mWhere, H, v))
- if listp(index) and (gCursorPresent <> index) then
- set ObjRef to getaProp(index, #RefName)
- if getaProp(index, #do) = #rollOver then
- CursorRollover(ObjRef)
- set gCursorPresent to index
- return #false
- else
- if getaProp(index, #do) = #cursor then
- CursorGraphic(ObjRef, H, v)
- set gCursorPresent to index
- return #true
- else
- if getaProp(index, #do) = #Handler then
- do(getaProp(getaProp(getaProp(gOBJECTS, ObjRef), #action), #rollOver))
- set gCursorPresent to index
- return #false
- end if
- end if
- end if
- set gCursorPresent to index
- next repeat
- end if
- if gCursorPresent = index then
- if getaProp(index, #do) = #cursor then
- set the locH of sprite sCURSORSPRITE to H
- set the locV of sprite sCURSORSPRITE to v
- cursor(200)
- return #true
- end if
- next repeat
- end if
- set the loc of sprite sCURSORSPRITE to point(-2000, -2000)
- set the castNum of sprite sCURSORSPRITE to cNullCast
- set gCursorPresent to #true
- return #false
- end repeat
- end
-
- on CursorRollover ObjRef
- set obj to getaProp(gOBJECTS, ObjRef)
- set the loc of sprite sCURSORSPRITE to getaProp(obj, #loc)
- set the castNum of sprite sCURSORSPRITE to getaProp(getaProp(obj, #cast), #rollOver)
- end
-
- on CursorGraphic ObjRef, H, v
- set obj to getaProp(gOBJECTS, ObjRef)
- set the locH of sprite sCURSORSPRITE to H
- set the locV of sprite sCURSORSPRITE to v
- set the castNum of sprite sCURSORSPRITE to getaProp(getaProp(obj, #cast), #rollOver)
- set gLastCursor to getaProp(getaProp(obj, #cast), #rollOver)
- cursor(200)
- end
-
- on doMouseDown
- if the lastClick > 30 then
- exit
- end if
- set H to the mouseH
- set v to the mouseV
- set aPoint to point(H, v)
- set ObjRef to inHotSpot(aPoint)
- if ObjRef <> #empty then
- do(string(getaProp(getaProp(getaProp(gOBJECTS, ObjRef), #action), #down) & "(#" & ObjRef & ")"))
- else
- if gHaveNavs <> #false then
- set navRefNum to inNavSpot(H, v)
- if navRefNum <> #empty then
- genExitKF(getAt(getaProp(gCurKeyList, #GoWhere), navRefNum))
- end if
- end if
- end if
- end
-
- on keyDown
- doKeyDown()
- end
-
- on doKeyDown
- if the shiftDown and (gGlobal = 1) then
- set theKey to the key
- if (theKey = "m") or (theKey = "M") then
- open(window (the pathName & "DEBUG" & gfileSep & "memMon"))
- else
- if (theKey = "s") or (theKey = "S") then
- open(window (the pathName & "DEBUG" & gfileSep & "status"))
- else
- if (theKey = "p") or (theKey = "P") then
- open(window (the pathName & "DEBUG" & gfileSep & "mockmsg3"))
- end if
- end if
- end if
- end if
- end
-
- on UniquieID aList
- set ID to count(aList)
- set Match to #false
- repeat while Match = #false
- set ID to ID + 1
- if voidp(getaProp(aList, ID)) then
- set Match to #true
- end if
- end repeat
- return ID
- end
-
- on InittheTimer
- startTimer()
- set gTimerList to [:]
- sort(gTimerList)
- end
-
- on startTheTimer aStopTime, ActionatTime, ObjRef
- set aStartTime to the timer
- if voidp(aStopTime) then
- return [#Start: aStartTime, #TimeRefNum: #empty]
- else
- if not voidp(ActionatTime) then
- set EndTime to aStartTime + aStopTime
- set ThisTimer to [#Start: aStartTime, #end: EndTime, #action: ActionatTime, #TimeRefNum: UniquieID(gTimerList)]
- if not voidp(ObjRef) then
- set obj to getaProp(gOBJECTS, ObjRef)
- if voidp(getaProp(obj, #timer)) then
- setaProp(obj, #timer, [:])
- end if
- set ThisTimer to [#Start: aStartTime, #end: EndTime, #action: ActionatTime, #TimeRefNum: the ticks]
- setaProp(getaProp(obj, #timer), getaProp(ThisTimer, #TimeRefNum), ThisTimer)
- end if
- setaProp(gTimerList, getaProp(ThisTimer, #TimeRefNum), ThisTimer)
- return ThisTimer
- end if
- end if
- end
-
- on CallTheTimer
- if count(gTimerList) > 0 then
- TimertheCheck()
- end if
- end
-
- on TimertheCheck
- set Expired to []
- repeat with TimeList in gTimerList
- if the timer > getaProp(TimeList, #end) then
- add(Expired, TimeList)
- end if
- end repeat
- if count(Expired) > 0 then
- repeat with TimeList in Expired
- ExecutetheTimer(TimeList)
- end repeat
- end if
- end
-
- on CheckTimePassed TimeList
- set aTime to the timer - getaProp(TimeList, #Start)
- return aTime
- end
-
- on ExecutetheTimer TimeList
- DeletetheTimer(TimeList)
- do(getaProp(TimeList, #action))
- end
-
- on DeletetheTimer TimeList
- deleteProp(gTimerList, getaProp(TimeList, #TimeRefNum))
- end
-
- on inHotSpot2 H, v
- set nHotr to count(gHotRects)
- repeat with X = 1 to nHotr
- set arefname to inThisSpot(H, v, getAt(gHotRects, X))
- if arefname <> #empty then
- return arefname
- end if
- end repeat
- return #empty
- end
-
- on inHotSpot aPoint
- set howMany to count(gHotRects)
- if howMany > 0 then
- repeat with thisOBJ = howMany down to 1
- set thisListValue to getAt(gHotRects, thisOBJ)
- set rectValue to getaProp(thisListValue, #rect)
- if not voidp(rectValue) then
- if inside(aPoint, rectValue) then
- return getaProp(thisListValue, #RefName)
- end if
- end if
- end repeat
- end if
- return #empty
- end
-
- on inNavSpot H, v
- set Where to xNAVXOBJ(mWhere, H, v)
- if Where > 0 then
- if getAt(getaProp(gCurKeyList, #GoWhere), Where) <> #empty then
- return Where
- end if
- end if
- return #empty
- end
-
- on inThisSpot H, v, aRectList
- if inside(point(H, v), getaProp(aRectList, #rect)) then
- return getaProp(aRectList, #RefName)
- else
- return #empty
- end if
- end
-
- on QTLOOP
- if the movieRate of sprite sQTSPRITE then
- go(the frame)
- else
- HideQTTrans()
- go("KeyFrame")
- end if
- end
-
- on HideQTTrans
- set the movieRate of sprite sQTSPRITE to 0
- set the locV of sprite sQTSPRITE to 10000
- updateStage()
- end
-
- on ShowQTTrans
- set the rect of sprite sQTSPRITE to rect(0, 0, 560, 336)
- end
-
- on CallAnimEngine
- set activeObjectsCount to count(gAnimationObjects)
- if activeObjectsCount > 0 then
- repeat with objectNum = 1 to activeObjectsCount
- stepAnimation(getAt(gAnimationObjects, objectNum))
- end repeat
- if count(gDeathRow) > 0 then
- repeat with condemned in gDeathRow
- death(getaProp(gAnimationObjects, condemned))
- end repeat
- set gDeathRow to []
- end if
- end if
- end
-
- on ShiftgHotrects ObjRef
- set obj to getaProp(gOBJECTS, ObjRef)
- set the rect of sprite getaProp(obj, #spriteNum) to getaProp(obj, #Data)
- updateStage()
- set the rect of sprite getaProp(obj, #spriteNum) to NULLRECT
- end
-
- on DoCharacterMovie ObjRef
- set obj to getaProp(gOBJECTS, ObjRef)
- setSoundState(#pause)
- if getaProp(obj, #DisplayState) <> #OffScreen then
- set the movieRate of sprite sQTCharSprite to 0
- updateStage()
- set TotalMov to count(getaProp(getaProp(obj, #cast), getaProp(obj, #DisplayState)))
- setaProp(obj, #ConCount, getaProp(obj, #ConCount) + 1)
- if TotalMov >= getaProp(obj, #ConCount) then
- set aName to getAt(getaProp(getaProp(obj, #cast), getaProp(obj, #DisplayState)), getaProp(obj, #ConCount))
- else
- set aName to getAt(getaProp(getaProp(obj, #cast), getaProp(obj, #DisplayState)), TotalMov)
- end if
- set the fileName of cast cNUllCharmovie to string(gQTmovPath & aName)
- updateStage()
- set the loc of sprite sQTCharSprite to getaProp(obj, #loc)
- set the movieTime of sprite sQTCharSprite to 0
- set the movieRate of sprite sQTCharSprite to 1
- updateStage()
- end if
- end
-